package com.wuwei.elearning.messageQueen;

/**
 * Factory for creating and accessing the message queue
 */
public class MessageQueueFactory {
    private static MessageQueue instance;
    
    private MessageQueueFactory() {
        // Private constructor to prevent instantiation
    }
    
    /**
     * Get the message queue instance
     * 
     * @return The message queue instance
     */
    public static synchronized MessageQueue getInstance() {
        if (instance == null) {
            instance = new MessageQueue();
            // Start the message queue
            instance.start();
        }
        return instance;
    }
    
    /**
     * Shutdown the message queue instance
     */
    public static synchronized void shutdown() {
        if (instance != null) {
            instance.stop();
            instance = null;
        }
    }
} 